linux command

time

Linux Command – time ใช้ในการจับเวลาการทำงาน process

 

คำสั่ง

time <command>

$ time df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 1964668 0 1964668 0% /dev
tmpfs 396944 26872 370072 7% /run
/dev/sda1 74843288 4598524 66419820 7% /
tmpfs 1984704 0 1984704 0% /dev/shm
tmpfs 5120 0 5120 0% /run/lock
tmpfs 1984704 0 1984704 0% /sys/fs/cgroup
/dev/sda2 185307 57082 114535 34% /boot
tmpfs 396944 0 396944 0% /run/user/1000

real 0m0.015s
user 0m0.000s
sys 0m0.000s

 

โครงสร้างคำสั่ง

 time [ -apqvV ] [ -f FORMAT ] [ -o FILE ]
 [ --append ] [ --verbose ] [ --quiet ] [ --portability ]
 [ --format=FORMAT ] [ --output=FILE ] [ --version ]
 [ --help ] COMMAND [ ARGS ]

 

รายละเอียด

เป็นคำสั่งที่ใช้ในการจับเวลาการทำงาน process

 

Option

 -o FILE, --output=FILE
 Write the resource use statistics to FILE instead of to the standard error stream. By default, this overwrites the file, destroying the file's previous contents. This
 option is useful for collecting information on interactive programs and programs that produce output on the standard error stream.

 -a, --append
 Append the resource use information to the output file instead of overwriting it. This option is only useful with the `-o' or `--output' option.

 -f FORMAT, --format FORMAT
 Use FORMAT as the format string that controls the output of time. See the below more information.

 --help Print a summary of the command line options and exit.

 -p, --portability
 Use the following format string, for conformance with POSIX standard 1003.2:
 real %e
 user %U
 sys %S

 -v, --verbose
 Use the built-in verbose format, which displays each available piece of information on the program's resource use on its own line, with an English description of its
 meaning.

 --quiet
 Do not report the status of the program even if it is different from zero.

 -V, --version
 Print the version number of time and exit.

 

กลุ่มคำสั่ง

tcsh(1), printf(3)

 

Reference:

คำสั่ง Unix – Linux Command

Linux, Unix

 

Author: Suphakit Annoppornchai

Credit: https://saixiii.com

Leave a Reply